const obj = {
    name: 'kkk',
    age: '21'
}
function render (template, data) {
    let reg = /\${(\w*)}/
    if (reg.test(template)) {
        const value = reg.exec(template)[1]
        template = template.replace(reg, data[value])
        return render(template, data)
    }
    return template
}

let res = render('my name is ${name},age is  ${age}', obj)
console.log(res);